<?php namespace Common\Model;
use Hdphp\Model\Model;

class OrderList extends  Model{
    protected $table='orderlist';
    public function store(){
        $orderModel=new Orderd();
        $ordernum=$_SESSION['ordernum'];
        $oid=$orderModel->where("ordernum='{$ordernum}'")->pluck('oid');
        foreach($_SESSION['cart']['goods'] as $k=>$u){
            $commodlistModel=new Commodlist();
            $colid=$commodlistModel->where("cogroupid='{$u['colizuheid']}'")->pluck('colid');
            $data[$k]=array(
              'olinum'=>$u['num'],
              'olipri'=>$u['total'],
              'shop_orderd_oid'=>$oid,
              'shop_commodity_coid'=>$u['id'],
              'shop_commodlist_colid'=>$colid
            );
            $this->add($data[$k]);
        }
        return true;
    }
}